package com.ncepu.oj_new.judge.codesandbox;

import com.ncepu.oj_new.judge.codesandbox.model.ExecuteCodeRequest;
import com.ncepu.oj_new.judge.codesandbox.model.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * @author simon_jiang
 * @version 1.0
 */
@Slf4j
public class CodeSandBoxProxy implements CodeSandBox{

    private final CodeSandBox codeSandbox;

    public CodeSandBoxProxy(CodeSandBox codeSandbox) {
        this.codeSandbox = codeSandbox;
    }

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest request) {
        // Add any additional logic or checks here
        log.info("调用代码沙箱前：{}", request.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandbox.executeCode(request);
        log.info("调用代码沙箱后：{}", executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
